package com.hd.service.test;

import java.util.Calendar;
import java.util.List;

import com.hd.common.DataPage;
import com.hd.persistence.model.RepairReport;
import com.hd.utils.HdException;

public class RepairReportManagerTestCase extends BaseTest {
	
	//保存实体
//	public void testSaveRepairReport() throws HdException {
//		PurchaseRecord purchaseRecord = new PurchaseRecord();
//		purchaseRecord.setPurchaseRecordId(1L);
//		for ( int i = 0; i < 5; i++ ) {
//			RepairReport repairReport = new RepairReport();
//			repairReport.setPurchaseRecord(purchaseRecord);
//			repairReport.setRepairBillNo("00000" + i);
//			repairReport.setRepairDate(new Date());
//			repairReport.setRepairman("维修员" + i);
//			repairReport.setUnitName("单位名称" + i);
//			repairReport.setContactor("联系人" + i);
//			repairReport.setContactWay("0510-85910687");
//			repairReport.setAddress("无锡市");
//			repairReport.setAppraisalLevel(2);
//			repairReport.setSignatory("验收用户名");
//			repairReport.setCustomerId(1L);
//			repairReport.setCategory(1);
//			repairReport.setMachineNo("2345564" + i);
//			repairReport.setSigningForm("临时客户");
//			repairReport.setWorkProject("定期修理");
//			repairReport.setThisTimeCount(300);
//			repairReport.setChargeWay(1);
//			repairReport.setChargeStatus(1);
//			repairReport.setChargeDate(new Date());
//			repairReport.setCreateTimestamp(132456);
//			repairManager.saveRepairReport(repairReport);
//		}
//	}
	
	//分页查询维修报告书
//	public void testPageQueryRepairReports() throws HdException {
//		DataPage<RepairReport> dataPage = repairManager.pageQueryRepairReports(1, 10);
//		System.out.println("查询总数为:" + dataPage.getTotalCount());
//		List<RepairReport> repairReports = dataPage.getData();
//		for ( RepairReport repairReport : repairReports ) {
//			System.out.println(repairReport.getRepairReportId() + " " + repairReport.getAddress());
//		}
//	}
	
	
	//分页查询维修报告书
	public void testPageQueryRepairReports2() throws HdException {
		Calendar c = Calendar.getInstance();
		c.set(Calendar.MONTH, 2);
		c.set(Calendar.DAY_OF_MONTH, 26);
		c.set(Calendar.HOUR_OF_DAY, 0);
		c.set(Calendar.MINUTE, 0);
		c.set(Calendar.SECOND, 0);
		c.set(Calendar.MILLISECOND, 0);
		DataPage<RepairReport> dataPage = repairManager.pageQueryRepairReports(c.getTime(), "维修员0", "单位名称0", 1, "34556", 1, 100);
		System.out.println("查询总数为:" + dataPage.getTotalCount());
		List<RepairReport> repairReports = dataPage.getData();
		for ( RepairReport repairReport : repairReports ) {
			System.out.println(repairReport.getRepairReportId() + " " + repairReport.getAddress());
		}
	}

}
